<template>
    <t-app ref="app"></t-app>
</template>
<script lang="ts" setup>
    import { getImgUrl } from '@/common/common';
    import { useAppStore } from '@/store/modules/app';

    let advList = ref([] as any);
    let navList = ref([] as any);

    const counter = useAppStore();

    const onAdd = () => {
        console.log('获取属性值');
        console.log(counter.title);

        console.log('获取getTest');
        console.log(counter.getTest);

        console.log('获取changeVal');
        counter.changeVal();

        console.log('获取属性值');
        console.log(counter.title);
    };

    // 加载数据
    function loadData() {
        uni.$u.api.OpenPlatform.index().then((res: any) => {
            const { adv, nav } = res;

            // 获取幻灯片列表
            advList.value = adv.map((val: any) => {
                return getImgUrl(val.thumb);
            });

            navList.value = nav;
        });
    }

    onLoad(() => {
        loadData();
    });
</script>
